[Bug 67208] Horizontal rules in old documents are broken: only links in the files
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Tue Mar 3 19:57:30 PST 2015
https://bugs.documentfoundation.org/show_bug.cgi?id=67208
--- Comment #4 from superpwnzormegaman at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150304/7f2033de/attachment.html>
More information about the LibreOffice
mailing list