[Libreoffice-commits] core.git: 8 commits - download.lst include/sfx2 odk/source sfx2/source sw/source vcl/source vcl/unx
Caolán McNamara
caolanm at redhat.com
Wed Feb 24 13:42:29 UTC 2016
download.lst | 4
include/sfx2/classificationhelper.hxx | 5 +
odk/source/com/sun/star/lib/loader/WinRegKey.java | 32 ++++--
sfx2/source/view/classificationhelper.cxx | 15 +++
sw/source/core/edit/edfcol.cxx | 101 +++++++++++++++++++++-
vcl/source/window/toolbox2.cxx | 20 +++-
vcl/unx/gtk/gtksalmenu.cxx | 4
7 files changed, 164 insertions(+), 17 deletions(-)
New commits:
commit 13917e0755bb864f22d0cf75a43854acbdb1eaec
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 24 13:02:40 2016 +0000
mark checkable toolbox menu entries as checkable
e.g. the toplevel toolbars put excess entries in
menus. If the entry is not marked as checkable then
a native gtk menu entry will appear to be stateless
when it actually does have a toggle state
Change-Id: I7168b44d59fd64dfe264ed8ca26355252d697251
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index b2c7564..d2364c1 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1790,6 +1790,20 @@ bool ToolBox::ImplHasClippedItems()
return false;
}
+namespace
+{
+ MenuItemBits ConvertBitsFromToolBoxToMenu(ToolBoxItemBits nToolItemBits)
+ {
+ MenuItemBits nMenuItemBits = MenuItemBits::NONE;
+ if ((nToolItemBits & ToolBoxItemBits::CHECKABLE) ||
+ (nToolItemBits & ToolBoxItemBits::DROPDOWN))
+ {
+ nMenuItemBits |= MenuItemBits::CHECKABLE;
+ }
+ return nMenuItemBits;
+ }
+}
+
void ToolBox::UpdateCustomMenu()
{
// fill clipped items into menu
@@ -1825,7 +1839,8 @@ void ToolBox::UpdateCustomMenu()
if( it->IsClipped() )
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
- pMenu->InsertItem( id, it->maText, it->maImageOriginal, MenuItemBits::NONE, OString());
+ MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(it->mnBits);
+ pMenu->InsertItem( id, it->maText, it->maImageOriginal, nMenuItemBits, OString());
pMenu->SetItemCommand( id, it->maCommandStr );
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem ( id, it->meState == TRISTATE_TRUE );
@@ -1842,7 +1857,8 @@ void ToolBox::UpdateCustomMenu()
if( it->IsItemHidden() )
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
- pMenu->InsertItem( id, it->maText, it->maImageOriginal, MenuItemBits::NONE, OString() );
+ MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(it->mnBits);
+ pMenu->InsertItem( id, it->maText, it->maImageOriginal, nMenuItemBits, OString() );
pMenu->SetItemCommand( id, it->maCommandStr );
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem( id, it->meState == TRISTATE_TRUE );
commit 736f265c46130ce905be75f2141424486d52c8a9
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Feb 24 14:00:50 2016 +0100
cid#1326523,1326524: Resource leak on an exceptional path
Change-Id: I34016e7124ff33700bb33801145f478ed34e9262
diff --git a/odk/source/com/sun/star/lib/loader/WinRegKey.java b/odk/source/com/sun/star/lib/loader/WinRegKey.java
index fad5d34..65b3963 100644
--- a/odk/source/com/sun/star/lib/loader/WinRegKey.java
+++ b/odk/source/com/sun/star/lib/loader/WinRegKey.java
@@ -60,18 +60,28 @@ final class WinRegKey {
if ( is != null ) {
// generate a temporary name for lib file and write to temp
// location
- BufferedInputStream istream = new BufferedInputStream( is );
- File libfile = File.createTempFile( "unowinreg", ".dll" );
- libfile.deleteOnExit(); // ensure deletion
- BufferedOutputStream ostream = new BufferedOutputStream(
- new FileOutputStream( libfile ) );
- int bsize = 2048; int n = 0;
- byte[] buffer = new byte[bsize];
- while ( ( n = istream.read( buffer, 0, bsize ) ) != -1 ) {
- ostream.write( buffer, 0, n );
+ File libfile;
+ BufferedInputStream istream = null;
+ BufferedOutputStream ostream = null;
+ try {
+ istream = new BufferedInputStream( is );
+ libfile = File.createTempFile( "unowinreg", ".dll" );
+ libfile.deleteOnExit(); // ensure deletion
+ ostream = new BufferedOutputStream(
+ new FileOutputStream( libfile ) );
+ int bsize = 2048; int n = 0;
+ byte[] buffer = new byte[bsize];
+ while ( ( n = istream.read( buffer, 0, bsize ) ) != -1 ) {
+ ostream.write( buffer, 0, n );
+ }
+ } finally {
+ if (istream != null) {
+ istream.close();
+ }
+ if (ostream != null) {
+ ostream.close();
+ }
}
- istream.close();
- ostream.close();
// load library
System.load( libfile.getPath() );
} else {
commit 09fc095dd47e9e1025fc185ed1a10826f481f0cb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Feb 24 12:08:50 2016 +0100
sw classification header: avoid inserting the field multiple times
If there is a field that's the same we would append, don't do anything.
The document property is already updated, and the rest is automatic:
it's a field after all.
Change-Id: I68713629a6917657ff491646c1b7781a9603e4f2
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 3d8908a..cb8124c 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -20,6 +20,8 @@
#include <editsh.hxx>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <hintids.hxx>
#include <editeng/formatbreakitem.hxx>
@@ -59,6 +61,41 @@ std::set<OUString> lcl_getUsedPageStyles(SwViewShell* pShell)
return aRet;
}
+/// Search for a field named rFieldName of type rServiceName in xText.
+bool lcl_hasField(const uno::Reference<text::XText>& xText, const OUString& rServiceName, const OUString& rFieldName)
+{
+ uno::Reference<container::XEnumerationAccess> xParagraphEnumerationAccess(xText, uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParagraphs = xParagraphEnumerationAccess->createEnumeration();
+ while (xParagraphs->hasMoreElements())
+ {
+ uno::Reference<container::XEnumerationAccess> xTextPortionEnumerationAccess(xParagraphs->nextElement(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xTextPortions = xTextPortionEnumerationAccess->createEnumeration();
+ while (xTextPortions->hasMoreElements())
+ {
+ uno::Reference<beans::XPropertySet> xTextPortion(xTextPortions->nextElement(), uno::UNO_QUERY);
+ OUString aTextPortionType;
+ xTextPortion->getPropertyValue(UNO_NAME_TEXT_PORTION_TYPE) >>= aTextPortionType;
+ if (aTextPortionType != UNO_NAME_TEXT_FIELD)
+ continue;
+
+ uno::Reference<lang::XServiceInfo> xTextField;
+ xTextPortion->getPropertyValue(UNO_NAME_TEXT_FIELD) >>= xTextField;
+ if (!xTextField->supportsService(rServiceName))
+ continue;
+
+ OUString aName;
+ uno::Reference<beans::XPropertySet> xPropertySet(xTextField, uno::UNO_QUERY);
+ xPropertySet->getPropertyValue(UNO_NAME_NAME) >>= aName;
+ if (aName != rFieldName)
+ continue;
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
} // anonymous namespace
SwTextFormatColl& SwEditShell::GetDfltTextFormatColl() const
@@ -104,14 +141,19 @@ void SwEditShell::SetClassification(const OUString& rName)
if (!bHeaderIsOn)
xPageStyle->setPropertyValue(UNO_NAME_HEADER_IS_ON, uno::makeAny(true));
- // Append a field to the end of the header text.
- uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance("com.sun.star.text.TextField.DocInfo.Custom"), uno::UNO_QUERY);
- xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(SfxClassificationHelper::PROP_DOCHEADER()));
+ // If the header already contains a document header field, no need to do anything.
uno::Reference<text::XText> xHeaderText;
xPageStyle->getPropertyValue(UNO_NAME_HEADER_TEXT) >>= xHeaderText;
- uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY);
- xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, /*bAbsorb=*/false);
+ OUString aServiceName = "com.sun.star.text.TextField.DocInfo.Custom";
+ if (!lcl_hasField(xHeaderText, aServiceName, SfxClassificationHelper::PROP_DOCHEADER()))
+ {
+ // Append a field to the end of the header text.
+ uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance(aServiceName), uno::UNO_QUERY);
+ xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(SfxClassificationHelper::PROP_DOCHEADER()));
+ uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY);
+ xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, /*bAbsorb=*/false);
+ }
}
}
}
commit 4461e0541d9fc772984e2cfbe9464ae44563ad57
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Feb 24 11:07:28 2016 +0100
sw classification header: handle multiple page styles
Iterating over all text nodes of the document would be quite slow, use
the layout information instead.
Change-Id: I124ef62e171b08af681a3ae910ffbdf839e34270
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 6bc2e68..3d8908a 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -37,6 +37,29 @@
#include <docary.hxx>
#include <docsh.hxx>
#include <unoprnms.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+
+namespace
+{
+
+/// Find all page styles which are currently used in the document.
+std::set<OUString> lcl_getUsedPageStyles(SwViewShell* pShell)
+{
+ std::set<OUString> aRet;
+
+ SwRootFrame* pLayout = pShell->GetLayout();
+ for (SwFrame* pFrame = pLayout->GetLower(); pFrame; pFrame = pFrame->GetNext())
+ {
+ SwPageFrame* pPage = static_cast<SwPageFrame*>(pFrame);
+ if (const SwPageDesc *pDesc = pPage->FindPageDesc())
+ aRet.insert(pDesc->GetName());
+ }
+
+ return aRet;
+}
+
+} // anonymous namespace
SwTextFormatColl& SwEditShell::GetDfltTextFormatColl() const
{
@@ -69,22 +92,27 @@ void SwEditShell::SetClassification(const OUString& rName)
uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY);
uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName("Standard"), uno::UNO_QUERY);
-
- // If the header is off, turn it on.
- bool bHeaderIsOn = false;
- xPageStyle->getPropertyValue(UNO_NAME_HEADER_IS_ON) >>= bHeaderIsOn;
- if (!bHeaderIsOn)
- xPageStyle->setPropertyValue(UNO_NAME_HEADER_IS_ON, uno::makeAny(true));
-
- // Append a field to the end of the header text.
- uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance("com.sun.star.text.TextField.DocInfo.Custom"), uno::UNO_QUERY);
- xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(SfxClassificationHelper::PROP_DOCHEADER()));
- uno::Reference<text::XText> xHeaderText;
- xPageStyle->getPropertyValue(UNO_NAME_HEADER_TEXT) >>= xHeaderText;
- uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY);
- xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, /*bAbsorb=*/false);
+
+ std::set<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this);
+ for (const OUString& rPageStyleName : aUsedPageStyles)
+ {
+ uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(rPageStyleName), uno::UNO_QUERY);
+
+ // If the header is off, turn it on.
+ bool bHeaderIsOn = false;
+ xPageStyle->getPropertyValue(UNO_NAME_HEADER_IS_ON) >>= bHeaderIsOn;
+ if (!bHeaderIsOn)
+ xPageStyle->setPropertyValue(UNO_NAME_HEADER_IS_ON, uno::makeAny(true));
+
+ // Append a field to the end of the header text.
+ uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance("com.sun.star.text.TextField.DocInfo.Custom"), uno::UNO_QUERY);
+ xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(SfxClassificationHelper::PROP_DOCHEADER()));
+ uno::Reference<text::XText> xHeaderText;
+ xPageStyle->getPropertyValue(UNO_NAME_HEADER_TEXT) >>= xHeaderText;
+ uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY);
+ xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, /*bAbsorb=*/false);
+ }
}
}
commit 2df20dc87554957716d810b0c91804d535f561a7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Feb 24 10:40:06 2016 +0100
sw classification: put the relevant field to the header if policy wants so
Change-Id: I56d37a8c143dd5108bbc9f6444fe3e058378bf5e
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index c5ced4b..6bc2e68 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -17,10 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <editsh.hxx>
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+
#include <hintids.hxx>
#include <editeng/formatbreakitem.hxx>
#include <sfx2/classificationhelper.hxx>
-#include <editsh.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <edimp.hxx>
@@ -33,6 +36,7 @@
#include <swundo.hxx>
#include <docary.hxx>
#include <docsh.hxx>
+#include <unoprnms.hxx>
SwTextFormatColl& SwEditShell::GetDfltTextFormatColl() const
{
@@ -56,7 +60,32 @@ void SwEditShell::SetClassification(const OUString& rName)
return;
SfxClassificationHelper aHelper(*pDocShell);
+ // This updates the infobar as well.
aHelper.SetBACName(rName);
+
+ if (aHelper.HasDocumentHeader())
+ {
+ uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
+ uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName("Standard"), uno::UNO_QUERY);
+
+ // If the header is off, turn it on.
+ bool bHeaderIsOn = false;
+ xPageStyle->getPropertyValue(UNO_NAME_HEADER_IS_ON) >>= bHeaderIsOn;
+ if (!bHeaderIsOn)
+ xPageStyle->setPropertyValue(UNO_NAME_HEADER_IS_ON, uno::makeAny(true));
+
+ // Append a field to the end of the header text.
+ uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance("com.sun.star.text.TextField.DocInfo.Custom"), uno::UNO_QUERY);
+ xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(SfxClassificationHelper::PROP_DOCHEADER()));
+ uno::Reference<text::XText> xHeaderText;
+ xPageStyle->getPropertyValue(UNO_NAME_HEADER_TEXT) >>= xHeaderText;
+ uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY);
+ xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, /*bAbsorb=*/false);
+ }
}
// #i62675#
commit d599122730a84be29b2649b66a582d2269c4ed2b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Feb 24 09:29:51 2016 +0100
sfx2 classification: expose document header presence
Change-Id: Ic69af56982a89356571f0016164b60e22ab94cf8
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx
index c8892dc..0e279c7 100644
--- a/include/sfx2/classificationhelper.hxx
+++ b/include/sfx2/classificationhelper.hxx
@@ -41,7 +41,12 @@ public:
bool HasImpactLevel();
basegfx::BColor GetImpactLevelColor();
OUString GetDocumentWatermark();
+ /// The selected category has some content for the document header.
+ bool HasDocumentHeader();
void UpdateInfobar(SfxViewFrame& rViewFrame);
+
+ /// Brief text located at the top of each document's pages.
+ static const OUString& PROP_DOCHEADER();
};
#endif
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index 705c15e..5680e1a 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -416,6 +416,15 @@ bool SfxClassificationHelper::HasImpactLevel()
return true;
}
+bool SfxClassificationHelper::HasDocumentHeader()
+{
+ std::map<OUString, OUString>::iterator it = m_pImpl->m_aLabels.find("urn:bails:IntellectualProperty:Marking:document-header");
+ if (it == m_pImpl->m_aLabels.end() || it->second.isEmpty())
+ return false;
+
+ return true;
+}
+
basegfx::BColor SfxClassificationHelper::GetImpactLevelColor()
{
basegfx::BColor aRet;
@@ -512,4 +521,10 @@ void SfxClassificationHelper::UpdateInfobar(SfxViewFrame& rViewFrame)
}
}
+const OUString& SfxClassificationHelper::PROP_DOCHEADER()
+{
+ static OUString sProp("urn:bails:IntellectualProperty:Marking:document-header");
+ return sProp;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b8ee342576b707dbffe877f5c225b640ee65276d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 24 12:19:49 2016 +0000
gtk3: handle items without commands
e.g. the draw/impress context menus. Handle these like
MenuManager::Activate does
Change-Id: I02a0e377a2d3a57ac7ac9239aaa75dbb856489d2
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 49270bb..f31d515 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -52,7 +52,9 @@ static gchar* GetCommandForItem( GtkSalMenuItem* pSalMenuItem, gchar* aCurrentCo
if ( !pMenu )
return nullptr;
- OUString aMenuCommand = pMenu->GetItemCommand( nId );
+ OUString aMenuCommand = pMenu->GetItemCommand(nId);
+ if (aMenuCommand.isEmpty())
+ aMenuCommand = "slot:" + OUString::number(nId);
gchar* aCommandStr = g_strdup( OUStringToOString( aMenuCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
aCommand = g_strdup( aCommandStr );
commit a16159e50cc0c2e1a0d654080343ac03bfa518fc
Author: Eike Rathke <erack at redhat.com>
Date: Wed Feb 24 13:03:55 2016 +0100
update language-subtag-registry to 2016-02-10 release
Change-Id: Iff9301c7b82f932ef2c71cb1ed62cd24211e92d2
diff --git a/download.lst b/download.lst
index bfb375e..5f43b05 100644
--- a/download.lst
+++ b/download.lst
@@ -77,8 +77,8 @@ export JPEG_MD5SUM := 3353992aecaee1805ef4109aadd433e7
export JPEG_TARBALL := jpegsrc.v9a.tar.gz
export JPEG_TURBO_MD5SUM := 86b0d5f7507c2e6c21c00219162c3c44
export JPEG_TURBO_TARBALL := libjpeg-turbo-1.4.2.tar.gz
-export LANGTAGREG_MD5SUM := bf5986dbfa1c9a0f26cf1b00ed369484
-export LANGTAGREG_TARBALL := language-subtag-registry-2015-08-04.tar.bz2
+export LANGTAGREG_MD5SUM := d1e7c55a0383f7d720d3ead0b6117284
+export LANGTAGREG_TARBALL := language-subtag-registry-2016-02-10.tar.bz2
export LANGUAGETOOL_TARBALL := b63e6340a02ff1cacfeadb2c42286161-JLanguageTool-1.7.0.tar.bz2
export LCMS2_MD5SUM := f4c08d38ceade4a664ebff7228910a33
export LCMS2_TARBALL := lcms2-2.6.tar.gz
More information about the Libreoffice-commits
mailing list