Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


https://bugs.documentfoundation.org/show_bug.cgi?id=67208

--- Comment #4 from superpwnzormegaman@gmail.com ---
Hello opensource noob, but (kindoff) experienced c++'er here.
I did the detection part with:

diff --git a/xmloff/source/text/XMLTextFrameContext.cxx
b/xmloff/source/text/XMLTextFrameContext.cxx
index 58ed9b3..0b5e4e8 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -721,6 +721,30 @@ void XMLTextFrameContext_Impl::Create( bool
/*bHRefOrBase64*/ )
             GetImport().GetTextImport();
         if( !sHRef.isEmpty() )
         {
+            /**
+             * BUG: 67208
+             *
+             * in old documents horizontal rulers are shown as links to
+             * nonexisting images.
+             *
+             * In here we replace them with ...
+             */
+            const OUString matchString = OUString("/gallery/rulers/");
+            const sal_Int32 matchLength = matchString.getLength();
+            for(sal_Int32 i = sHRef.getLength() - matchLength; i > 0; i--){
+                if(sHRef.match(matchString, i)){
+                    SAL_DEBUG("replace something with something here?");
+                }
+                /*
+                 * check to see if we are going deeper than one dir from the
end
+                 * of the path, if so stop, because our matching
matchStringing is only
+                 * relevant for the last part of the path
+                 */
+                if(sHRef[i+matchLength-1] == '/'){
+                    i = -1;
+                }
+            }
             bool bForceLoad = xTxtImport->IsInsertMode() ||
                                   xTxtImport->IsBlockMode() ||
                                   xTxtImport->IsStylesOnlyMode() ||


But I'm not sure with what I should replace these links.

Also not that this fix will probably break any images that are put into any
"/gallery/rulers/" folder, so this path should probably be as long as possible.
I tried to reduce the chance of these name clashes by starting the search at
the end of the path and going forward up the name untill the first / occurs,
assuming that all these ruler styles are directly in the rulers directory, and
don't have sub directories (am I right in this?).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.