From d3fb6d227c77198aa0b70d6f5260ff239f5d692c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 25 Oct 2012 14:46:59 +0100 Subject: [PATCH] remove .ui mark-up in favor of font attributes so we can keep translations markup free, and it matches better our existing font use in controls Change-Id: Ib762030f8bf831f2b0afabdd643508e660ad9266 See: https://live.gnome.org/GnomeGoals/RemoveMarkupInMessages --- cui/uiconfig/ui/charnamepage.ui | 30 +++-- cui/uiconfig/ui/effectspage.ui | 12 +- cui/uiconfig/ui/insertoleobject.ui | 12 +- cui/uiconfig/ui/insertplugin.ui | 12 +- cui/uiconfig/ui/positionpage.ui | 30 +++-- cui/uiconfig/ui/twolinespage.ui | 18 ++- cui/uiconfig/ui/zoomdialog.ui | 12 +- sc/uiconfig/scalc/ui/printeroptions.ui | 6 +- sd/uiconfig/sdraw/ui/printeroptions.ui | 18 ++- sd/uiconfig/simpress/ui/printeroptions.ui | 18 ++- sfx2/uiconfig/ui/password.ui | 12 +- starmath/uiconfig/smath/ui/printeroptions.ui | 12 +- svtools/uiconfig/ui/graphicexport.ui | 78 ++++++++---- sw/uiconfig/sw/ui/20872.ui | 12 +- sw/uiconfig/sw/ui/20876.ui | 12 +- sw/uiconfig/swriter/ui/autoformattable.ui | 12 +- sw/uiconfig/swriter/ui/bibliographyentry.ui | 6 +- sw/uiconfig/swriter/ui/charurlpage.ui | 12 +- sw/uiconfig/swriter/ui/columnwidth.ui | 6 +- sw/uiconfig/swriter/ui/converttexttable.ui | 12 +- sw/uiconfig/swriter/ui/horizontalrule.ui | 6 +- sw/uiconfig/swriter/ui/indexentry.ui | 6 +- sw/uiconfig/swriter/ui/insertbreak.ui | 6 +- sw/uiconfig/swriter/ui/inserttable.ui | 18 ++- sw/uiconfig/swriter/ui/linenumbering.ui | 30 +++-- sw/uiconfig/swriter/ui/printeroptions.ui | 18 ++- sw/uiconfig/swriter/ui/sortdialog.ui | 30 +++-- sw/uiconfig/swriter/ui/splittable.ui | 6 +- sw/uiconfig/swriter/ui/stringinput.ui | 6 +- sw/uiconfig/swriter/ui/titlepage.ui | 18 ++- sw/uiconfig/swriter/ui/wordcount.ui | 12 +- vcl/inc/vcl/builder.hxx | 5 +- vcl/inc/vcl/window.hxx | 7 ++ vcl/qa/cppunit/builder/demo.ui | 11 -- vcl/source/window/builder.cxx | 123 ++++++++----------- vcl/source/window/window2.cxx | 47 +++++++ vcl/uiconfig/ui/printdialog.ui | 42 ++++--- 37 files changed, 466 insertions(+), 267 deletions(-) diff --git a/cui/uiconfig/ui/charnamepage.ui b/cui/uiconfig/ui/charnamepage.ui index 6f825251e20e..eab5b32ccec7 100644 --- a/cui/uiconfig/ui/charnamepage.ui +++ b/cui/uiconfig/ui/charnamepage.ui @@ -156,8 +156,10 @@ True False - <b>Font</b> - True + Font + + + @@ -305,8 +307,10 @@ True False - <b>Western text font</b> - True + Western text font + + + @@ -454,8 +458,10 @@ True False - <b>Asian text font</b> - True + Asian text font + + + @@ -603,8 +609,10 @@ True False - <b>CTL font</b> - True + CTL font + + + @@ -638,8 +646,10 @@ True False - <b>Preview</b> - True + Preview + + + diff --git a/cui/uiconfig/ui/effectspage.ui b/cui/uiconfig/ui/effectspage.ui index 0fe4462cd5dc..6391f4dbd89f 100644 --- a/cui/uiconfig/ui/effectspage.ui +++ b/cui/uiconfig/ui/effectspage.ui @@ -617,8 +617,10 @@ True False - <b>Options</b> - True + Options + + + @@ -652,8 +654,10 @@ True False - <b>Preview</b> - True + Preview + + + diff --git a/cui/uiconfig/ui/insertoleobject.ui b/cui/uiconfig/ui/insertoleobject.ui index c41ea5b106f5..e823476067cf 100644 --- a/cui/uiconfig/ui/insertoleobject.ui +++ b/cui/uiconfig/ui/insertoleobject.ui @@ -90,8 +90,10 @@ True False - <b>Object type</b> - True + Object type + + + @@ -173,8 +175,10 @@ True False - <b>File</b> - True + File + + + diff --git a/cui/uiconfig/ui/insertplugin.ui b/cui/uiconfig/ui/insertplugin.ui index ef3ac40a3f6c..ae2c4f7b9d15 100644 --- a/cui/uiconfig/ui/insertplugin.ui +++ b/cui/uiconfig/ui/insertplugin.ui @@ -69,8 +69,10 @@ True False - <b>File/URL</b> - True + File/URL + + + @@ -117,8 +119,10 @@ True False - <b>Options</b> - True + Options + + + diff --git a/cui/uiconfig/ui/positionpage.ui b/cui/uiconfig/ui/positionpage.ui index 64bb40b0e9ed..d142bae0238c 100644 --- a/cui/uiconfig/ui/positionpage.ui +++ b/cui/uiconfig/ui/positionpage.ui @@ -210,8 +210,10 @@ True False - <b>Position</b> - True + Position + + + @@ -370,8 +372,10 @@ True False - <b>Rotation / Scaling</b> - True + Rotation / Scaling + + + False @@ -384,8 +388,10 @@ True False 0 - <b>Rotation</b> - True + Rotation + + + False @@ -482,8 +488,10 @@ True False - <b>Spacing</b> - True + Spacing + + + @@ -517,8 +525,10 @@ True False - <b>Preview</b> - True + Preview + + + diff --git a/cui/uiconfig/ui/twolinespage.ui b/cui/uiconfig/ui/twolinespage.ui index acf20924e365..661d0554fe6e 100644 --- a/cui/uiconfig/ui/twolinespage.ui +++ b/cui/uiconfig/ui/twolinespage.ui @@ -34,8 +34,10 @@ True False - <b>Double-lined</b> - True + Double-lined + + + @@ -130,8 +132,10 @@ True False - <b>Enclosing character</b> - True + Enclosing character + + + @@ -165,8 +169,10 @@ True False - <b>Preview</b> - True + Preview + + + diff --git a/cui/uiconfig/ui/zoomdialog.ui b/cui/uiconfig/ui/zoomdialog.ui index d79cad0a07ce..5a35580dcd07 100644 --- a/cui/uiconfig/ui/zoomdialog.ui +++ b/cui/uiconfig/ui/zoomdialog.ui @@ -224,8 +224,10 @@ True False - <b>Zoom factor</b> - True + Zoom factor + + + @@ -363,8 +365,10 @@ True False - <b>View layout</b> - True + View layout + + + diff --git a/sc/uiconfig/scalc/ui/printeroptions.ui b/sc/uiconfig/scalc/ui/printeroptions.ui index 6a5a97be0b10..2c9fb5672ddf 100644 --- a/sc/uiconfig/scalc/ui/printeroptions.ui +++ b/sc/uiconfig/scalc/ui/printeroptions.ui @@ -36,8 +36,10 @@ True False - <b>Pages</b> - True + Pages + + + diff --git a/sd/uiconfig/sdraw/ui/printeroptions.ui b/sd/uiconfig/sdraw/ui/printeroptions.ui index dcdc896bf7f1..b318e5a04d0f 100644 --- a/sd/uiconfig/sdraw/ui/printeroptions.ui +++ b/sd/uiconfig/sdraw/ui/printeroptions.ui @@ -65,8 +65,10 @@ True False - <b>Contents</b> - True + Contents + + + @@ -157,8 +159,10 @@ True False - <b>Color</b> - True + Color + + + @@ -268,8 +272,10 @@ True False - <b>Size</b> - True + Size + + + diff --git a/sd/uiconfig/simpress/ui/printeroptions.ui b/sd/uiconfig/simpress/ui/printeroptions.ui index 78aa5e514c02..838b5c003e06 100644 --- a/sd/uiconfig/simpress/ui/printeroptions.ui +++ b/sd/uiconfig/simpress/ui/printeroptions.ui @@ -82,8 +82,10 @@ True False - <b>Contents</b> - True + Contents + + + @@ -174,8 +176,10 @@ True False - <b>Color</b> - True + Color + + + @@ -285,8 +289,10 @@ True False - <b>Size<b> - True + Size + + + diff --git a/sfx2/uiconfig/ui/password.ui b/sfx2/uiconfig/ui/password.ui index 3f48b6aad0d6..dc14bd25cd7b 100644 --- a/sfx2/uiconfig/ui/password.ui +++ b/sfx2/uiconfig/ui/password.ui @@ -191,8 +191,10 @@ True False - <b>Password</b> - True + Password + + + @@ -287,8 +289,10 @@ True False - <b>Second Password</b> - True + Second Password + + + diff --git a/starmath/uiconfig/smath/ui/printeroptions.ui b/starmath/uiconfig/smath/ui/printeroptions.ui index ec08385c11ea..8bd161a378f7 100644 --- a/starmath/uiconfig/smath/ui/printeroptions.ui +++ b/starmath/uiconfig/smath/ui/printeroptions.ui @@ -82,8 +82,10 @@ True False - <b>Contents</b> - True + Contents + + + @@ -195,8 +197,10 @@ True False - <b>Size</b> - True + Size + + + diff --git a/svtools/uiconfig/ui/graphicexport.ui b/svtools/uiconfig/ui/graphicexport.ui index edf64bec2d93..4350ccef74ed 100644 --- a/svtools/uiconfig/ui/graphicexport.ui +++ b/svtools/uiconfig/ui/graphicexport.ui @@ -239,8 +239,10 @@ True False - <b>Size</b> - True + Size + + + @@ -272,8 +274,10 @@ True False - <b>Color Depth</b> - True + Color Depth + + + @@ -365,8 +369,10 @@ True False - <b>Quality</b> - True + Quality + + + @@ -458,8 +464,10 @@ True False - <b>Compression</b> - True + Compression + + + @@ -498,8 +506,10 @@ True False - <b>Compression</b> - True + Compression + + + @@ -538,8 +548,10 @@ True False - <b>Mode</b> - True + Mode + + + @@ -578,8 +590,10 @@ True False - <b>Drawing Objects</b> - True + Drawing Objects + + + @@ -650,8 +664,10 @@ True False - <b>Encoding</b> - True + Encoding + + + @@ -724,8 +740,10 @@ True False - <b>Preview</b> - True + Preview + + + @@ -798,8 +816,10 @@ True False - <b>Color format</b> - True + Color format + + + @@ -872,8 +892,10 @@ True False - <b>Version</b> - True + Version + + + @@ -946,8 +968,10 @@ True False - <b>Compression</b> - True + Compression + + + @@ -991,8 +1015,10 @@ True False - <b>Information</b> - True + Information + + + diff --git a/sw/uiconfig/sw/ui/20872.ui b/sw/uiconfig/sw/ui/20872.ui index ceee7d5a5c48..3e2d5efb3fbd 100644 --- a/sw/uiconfig/sw/ui/20872.ui +++ b/sw/uiconfig/sw/ui/20872.ui @@ -79,8 +79,10 @@ True False - <b>Level</b> - True + Level + + + @@ -430,8 +432,10 @@ True False - <b>Position and spacing</b> - True + Position and spacing + + + diff --git a/sw/uiconfig/sw/ui/20876.ui b/sw/uiconfig/sw/ui/20876.ui index 82c1e9e169d8..ca09c2b93b1e 100644 --- a/sw/uiconfig/sw/ui/20876.ui +++ b/sw/uiconfig/sw/ui/20876.ui @@ -34,8 +34,10 @@ True False - <b>Level</b> - True + Level + + + @@ -326,8 +328,10 @@ True False - <b>Numbering</b> - True + Numbering + + + diff --git a/sw/uiconfig/swriter/ui/autoformattable.ui b/sw/uiconfig/swriter/ui/autoformattable.ui index f51c56d8c938..bf3d8cc64287 100644 --- a/sw/uiconfig/swriter/ui/autoformattable.ui +++ b/sw/uiconfig/swriter/ui/autoformattable.ui @@ -184,8 +184,10 @@ True False - <b>Format</b> - True + Format + + + @@ -313,8 +315,10 @@ True False - <b>Formatting</b> - True + Formatting + + + diff --git a/sw/uiconfig/swriter/ui/bibliographyentry.ui b/sw/uiconfig/swriter/ui/bibliographyentry.ui index 4f0e1844dcdb..e6bb977e166f 100644 --- a/sw/uiconfig/swriter/ui/bibliographyentry.ui +++ b/sw/uiconfig/swriter/ui/bibliographyentry.ui @@ -279,8 +279,10 @@ True False - <b>Entry</b> - True + Entry + + + diff --git a/sw/uiconfig/swriter/ui/charurlpage.ui b/sw/uiconfig/swriter/ui/charurlpage.ui index 4fdeb6540917..a12265fc07c1 100644 --- a/sw/uiconfig/swriter/ui/charurlpage.ui +++ b/sw/uiconfig/swriter/ui/charurlpage.ui @@ -197,8 +197,10 @@ True False - <b>Hyperlink</b> - True + Hyperlink + + + @@ -284,8 +286,10 @@ True False - <b>Character styles</b> - True + Character styles + + + diff --git a/sw/uiconfig/swriter/ui/columnwidth.ui b/sw/uiconfig/swriter/ui/columnwidth.ui index e506ddf8166c..d14a81b5045a 100644 --- a/sw/uiconfig/swriter/ui/columnwidth.ui +++ b/sw/uiconfig/swriter/ui/columnwidth.ui @@ -162,8 +162,10 @@ True False - <b>Width</b> - True + Width + + + diff --git a/sw/uiconfig/swriter/ui/converttexttable.ui b/sw/uiconfig/swriter/ui/converttexttable.ui index 247379a2eaa3..1b3e6b151e8f 100644 --- a/sw/uiconfig/swriter/ui/converttexttable.ui +++ b/sw/uiconfig/swriter/ui/converttexttable.ui @@ -231,8 +231,10 @@ True False - <b>Separate text at</b> - True + Separate text at + + + @@ -415,8 +417,10 @@ True False - <b>Options</b> - True + Options + + + diff --git a/sw/uiconfig/swriter/ui/horizontalrule.ui b/sw/uiconfig/swriter/ui/horizontalrule.ui index a88511482c0d..43c9eb7d6275 100644 --- a/sw/uiconfig/swriter/ui/horizontalrule.ui +++ b/sw/uiconfig/swriter/ui/horizontalrule.ui @@ -98,8 +98,10 @@ True False - <b>Selection</b> - True + Selection + + + diff --git a/sw/uiconfig/swriter/ui/indexentry.ui b/sw/uiconfig/swriter/ui/indexentry.ui index b20a6a33b395..7dc618418675 100644 --- a/sw/uiconfig/swriter/ui/indexentry.ui +++ b/sw/uiconfig/swriter/ui/indexentry.ui @@ -625,8 +625,10 @@ True False - <b>Selection</b> - True + Selection + + + diff --git a/sw/uiconfig/swriter/ui/insertbreak.ui b/sw/uiconfig/swriter/ui/insertbreak.ui index 4a49ca53d41e..99a290debd2a 100644 --- a/sw/uiconfig/swriter/ui/insertbreak.ui +++ b/sw/uiconfig/swriter/ui/insertbreak.ui @@ -239,8 +239,10 @@ True False - <b>Type</b> - True + Type + + + diff --git a/sw/uiconfig/swriter/ui/inserttable.ui b/sw/uiconfig/swriter/ui/inserttable.ui index 21fdda99af77..d354318e04d2 100644 --- a/sw/uiconfig/swriter/ui/inserttable.ui +++ b/sw/uiconfig/swriter/ui/inserttable.ui @@ -115,8 +115,10 @@ True False - <b>Name</b> - True + Name + + + @@ -221,8 +223,10 @@ True False - <b>Size</b> - True + Size + + + @@ -390,8 +394,10 @@ True False 0.47999998927116394 - <b>Options</b> - True + Options + + + diff --git a/sw/uiconfig/swriter/ui/linenumbering.ui b/sw/uiconfig/swriter/ui/linenumbering.ui index 181935ab9319..b7559e4b1c3d 100644 --- a/sw/uiconfig/swriter/ui/linenumbering.ui +++ b/sw/uiconfig/swriter/ui/linenumbering.ui @@ -301,8 +301,10 @@ True False - <b>View</b> - True + View + + + @@ -412,8 +414,10 @@ True False - <b>Separator</b> - True + Separator + + + @@ -501,8 +505,10 @@ True False 1 - <b>Count</b> - True + Count + + + @@ -548,6 +554,12 @@ 1 10 + + 1000 + 3 + 1 + 10 + @@ -568,12 +580,6 @@ - - 1000 - 3 - 1 - 10 - 9999 0.5 diff --git a/sw/uiconfig/swriter/ui/printeroptions.ui b/sw/uiconfig/swriter/ui/printeroptions.ui index ea221ccff352..63d14eec9d28 100644 --- a/sw/uiconfig/swriter/ui/printeroptions.ui +++ b/sw/uiconfig/swriter/ui/printeroptions.ui @@ -116,8 +116,10 @@ True False - <b>Contents</b> - True + Contents + + + @@ -156,8 +158,10 @@ True False - <b>Color</b> - True + Color + + + @@ -196,8 +200,10 @@ True False - <b>Pages</b> - True + Pages + + + diff --git a/sw/uiconfig/swriter/ui/sortdialog.ui b/sw/uiconfig/swriter/ui/sortdialog.ui index 58bcae3ef225..20b07d795912 100644 --- a/sw/uiconfig/swriter/ui/sortdialog.ui +++ b/sw/uiconfig/swriter/ui/sortdialog.ui @@ -457,8 +457,10 @@ True False 0.56000000238418579 - <b>Sort criteria</b> - True + Sort criteria + + + @@ -538,8 +540,10 @@ True False - <b>Direction</b> - True + Direction + + + @@ -660,8 +664,10 @@ True False - <b>Separator</b> - True + Separator + + + @@ -708,8 +714,10 @@ True False - <b>Language</b> - True + Language + + + @@ -749,8 +757,10 @@ True False - <b>Setting</b> - True + Setting + + + diff --git a/sw/uiconfig/swriter/ui/splittable.ui b/sw/uiconfig/swriter/ui/splittable.ui index 2cb23b88b276..22b468c30891 100644 --- a/sw/uiconfig/swriter/ui/splittable.ui +++ b/sw/uiconfig/swriter/ui/splittable.ui @@ -176,8 +176,10 @@ True False - <b>Mode</b> - True + Mode + + + diff --git a/sw/uiconfig/swriter/ui/stringinput.ui b/sw/uiconfig/swriter/ui/stringinput.ui index d2212ddcc1dc..4138a88c53a8 100644 --- a/sw/uiconfig/swriter/ui/stringinput.ui +++ b/sw/uiconfig/swriter/ui/stringinput.ui @@ -71,8 +71,10 @@ True False 0 - <b>Name</b> - True + Name + + + 0 diff --git a/sw/uiconfig/swriter/ui/titlepage.ui b/sw/uiconfig/swriter/ui/titlepage.ui index 43180a1a9b4f..70dcbb117d2f 100644 --- a/sw/uiconfig/swriter/ui/titlepage.ui +++ b/sw/uiconfig/swriter/ui/titlepage.ui @@ -268,8 +268,10 @@ True False - <b>Make Title Pages</b> - True + Make Title Pages + + + @@ -414,8 +416,10 @@ True False - <b>Page Numbering</b> - True + Page Numbering + + + @@ -474,8 +478,10 @@ True False - <b>Edit Page Properties</b> - True + Edit Page Properties + + + diff --git a/sw/uiconfig/swriter/ui/wordcount.ui b/sw/uiconfig/swriter/ui/wordcount.ui index 04b9efae749e..81e43b366b93 100644 --- a/sw/uiconfig/swriter/ui/wordcount.ui +++ b/sw/uiconfig/swriter/ui/wordcount.ui @@ -187,8 +187,10 @@ True False - <b>Current selection</b> - True + Current selection + + + @@ -322,8 +324,10 @@ True False - <b>Whole document</b> - True + Whole document + + + diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx index 8ef33278acc2..de8da5154e84 100644 --- a/vcl/inc/vcl/builder.hxx +++ b/vcl/inc/vcl/builder.hxx @@ -165,7 +165,9 @@ public: //taking ownership of it bool replace(OString sID, Window &rReplacement); private: - Window *insertObject(Window *pParent, const OString &rClass, const OString &rID, stringmap &rVec); + Window *insertObject(Window *pParent, const OString &rClass, const OString &rID, + stringmap &rProps, stringmap &rPangoAttributes); + Window *makeObject(Window *pParent, const OString &rClass, const OString &rID, stringmap &rVec); bool extractGroup(const OString &id, stringmap &rVec); bool extractModel(const OString &id, stringmap &rVec); @@ -181,6 +183,7 @@ private: void handlePacking(Window *pCurrent, xmlreader::XmlReader &reader); void applyPackingProperty(Window *pCurrent, xmlreader::XmlReader &reader); void collectProperty(xmlreader::XmlReader &reader, const OString &rID, stringmap &rVec); + void collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap); void handleListStore(xmlreader::XmlReader &reader, const OString &rID); void handleRow(xmlreader::XmlReader &reader, const OString &rID, sal_Int32 nRowIndex); diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 54a9ba9bf394..90543e4207ee 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -1221,6 +1221,13 @@ public: */ virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue); + /* + * Sets a font attribute + * + * @return false if attribute is unknown + */ + bool set_font_attribute(const rtl::OString &rKey, const rtl::OString &rValue); + /* * Move this widget to be the nNewPosition'd child of its parent */ diff --git a/vcl/qa/cppunit/builder/demo.ui b/vcl/qa/cppunit/builder/demo.ui index b83fd65d5622..1b31adcb4511 100644 --- a/vcl/qa/cppunit/builder/demo.ui +++ b/vcl/qa/cppunit/builder/demo.ui @@ -348,7 +348,6 @@ True False Frame Label - True @@ -557,7 +556,6 @@ True False Make Title Pages - True @@ -703,7 +701,6 @@ True False Page Numbering - True @@ -763,7 +760,6 @@ True False Edit Page Properties - True @@ -937,7 +933,6 @@ True False Type - True @@ -1100,7 +1095,6 @@ True False Zoom factor - True @@ -1237,7 +1231,6 @@ True False View layout - True @@ -1299,7 +1292,6 @@ True False Level - True @@ -1589,7 +1581,6 @@ True False Numbering - True @@ -1651,7 +1642,6 @@ True False Level - True @@ -1854,7 +1844,6 @@ True False Position and spacing - True diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 8c330d083a08..34238e26e5aa 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -328,18 +328,6 @@ namespace return bVertical; } - bool extractMarkup(VclBuilder::stringmap &rMap) - { - bool bUseMarkup = false; - VclBuilder::stringmap::iterator aFind = rMap.find(OString("use-markup")); - if (aFind != rMap.end()) - { - bUseMarkup = toBool(aFind->second); - rMap.erase(aFind); - } - return bUseMarkup; - } - bool extractInconsistent(VclBuilder::stringmap &rMap) { bool bInconsistent = false; @@ -837,50 +825,10 @@ namespace { return pWindow->GetType() == WINDOW_TABPAGE; } - - //super cheesy markup, just globally set bold and/or - //italic if any tag exists and return detagged string - OString handleMarkup(Window &rWindow, const OString &rLabel) - { - OStringBuffer aBuf; - - xmlreader::XmlReader reader(rLabel.getStr(), rLabel.getLength()); - xmlreader::Span name; - int nsId; - - while(1) - { - xmlreader::XmlReader::Result res = reader.nextItem( - xmlreader::XmlReader::TEXT_RAW, &name, &nsId); - - if (res == xmlreader::XmlReader::RESULT_BEGIN) - { - if (name.equals(RTL_CONSTASCII_STRINGPARAM("b"))) - { - Font aFont(rWindow.GetControlFont()); - aFont.SetWeight(WEIGHT_BOLD); - rWindow.SetControlFont(aFont); - } - else if (name.equals(RTL_CONSTASCII_STRINGPARAM("i"))) - { - Font aFont(rWindow.GetControlFont()); - aFont.SetItalic(ITALIC_NORMAL); - rWindow.SetControlFont(aFont); - } - } - - if (res == xmlreader::XmlReader::RESULT_TEXT) - aBuf.append(name.begin, name.length); - - if (res == xmlreader::XmlReader::RESULT_DONE) - break; - } - - return aBuf.makeStringAndClear(); - } } -Window *VclBuilder::insertObject(Window *pParent, const OString &rClass, const OString &rID, stringmap &rMap) +Window *VclBuilder::insertObject(Window *pParent, const OString &rClass, + const OString &rID, stringmap &rProps, stringmap &rPango) { Window *pCurrentChild = NULL; @@ -891,7 +839,7 @@ Window *VclBuilder::insertObject(Window *pParent, const OString &rClass, const O if (pCurrentChild->IsDialog()) { Dialog *pDialog = (Dialog*)pCurrentChild; - pDialog->doDeferredInit(extractResizable(rMap)); + pDialog->doDeferredInit(extractResizable(rProps)); m_bToplevelHasDeferredInit = false; } if (pCurrentChild->GetHelpId().isEmpty()) @@ -909,32 +857,28 @@ Window *VclBuilder::insertObject(Window *pParent, const OString &rClass, const O //been seen yet, then make unattached widgets parent-less toplevels if (pParent == m_pParent && m_bToplevelHasDeferredInit) pParent = NULL; - pCurrentChild = makeObject(pParent, rClass, rID, rMap); + pCurrentChild = makeObject(pParent, rClass, rID, rProps); } if (pCurrentChild) { - //Support super-basic bold/italic hints - if (extractMarkup(rMap)) - { - VclBuilder::stringmap::iterator aFind = rMap.find(OString("label")); - if (aFind != rMap.end()) - { - OString &rLabel = aFind->second; - if (rLabel.indexOf('<') != -1) - rLabel = handleMarkup(*pCurrentChild, aFind->second); - } - } - - for (stringmap::iterator aI = rMap.begin(), aEnd = rMap.end(); aI != aEnd; ++aI) + for (stringmap::iterator aI = rProps.begin(), aEnd = rProps.end(); aI != aEnd; ++aI) { const OString &rKey = aI->first; const OString &rValue = aI->second; pCurrentChild->set_property(rKey, rValue); } + + for (stringmap::iterator aI = rPango.begin(), aEnd = rPango.end(); aI != aEnd; ++aI) + { + const OString &rKey = aI->first; + const OString &rValue = aI->second; + pCurrentChild->set_font_attribute(rKey, rValue); + } } - rMap.clear(); + rProps.clear(); + rPango.clear(); if (!pCurrentChild) pCurrentChild = m_aChildren.empty() ? pParent : m_aChildren.back().m_pWindow; @@ -1186,6 +1130,32 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader) } } +void VclBuilder::collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap) +{ + xmlreader::Span span; + int nsId; + + OString sProperty; + OString sValue; + + while (reader.nextAttribute(&nsId, &span)) + { + if (span.equals(RTL_CONSTASCII_STRINGPARAM("name"))) + { + span = reader.getAttributeValue(false); + sProperty = OString(span.begin, span.length); + } + else if (span.equals(RTL_CONSTASCII_STRINGPARAM("value"))) + { + span = reader.getAttributeValue(false); + sValue = OString(span.begin, span.length); + } + } + + if (!sProperty.isEmpty()) + rMap[sProperty] = sValue; +} + void VclBuilder::handleAdjustment(const OString &rID, stringmap &rProperties) { m_pParserState->m_aAdjustments.push_back(AdjustmentAndId(rID, rProperties)); @@ -1329,7 +1299,7 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader) int nLevel = 1; - stringmap aProperties; + stringmap aProperties, aPangoAttributes; if (!sPattern.isEmpty()) aProperties[OString("pattern")] = sPattern; @@ -1348,7 +1318,10 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader) if (name.equals(RTL_CONSTASCII_STRINGPARAM("child"))) { if (!pCurrentChild) - pCurrentChild = insertObject(pParent, sClass, sID, aProperties); + { + pCurrentChild = insertObject(pParent, sClass, sID, + aProperties, aPangoAttributes); + } handleChild(pCurrentChild, reader); } else @@ -1356,6 +1329,8 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader) ++nLevel; if (name.equals(RTL_CONSTASCII_STRINGPARAM("property"))) collectProperty(reader, sID, aProperties); + else if (name.equals(RTL_CONSTASCII_STRINGPARAM("attribute"))) + collectPangoAttribute(reader, aPangoAttributes); } } @@ -1375,7 +1350,7 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader) } if (!pCurrentChild) - pCurrentChild = insertObject(pParent, sClass, sID, aProperties); + pCurrentChild = insertObject(pParent, sClass, sID, aProperties, aPangoAttributes); return pCurrentChild; } @@ -1528,6 +1503,8 @@ void VclBuilder::collectProperty(xmlreader::XmlReader &reader, const OString &rI if (!sProperty.isEmpty()) { sProperty = sProperty.replace('_', '-'); + //https://live.gnome.org/GnomeGoals/RemoveMarkupInMessages + SAL_WARN_IF(sProperty == "use-markup", "vcl.layout", "Use pango attributes instead of mark-up"); rMap[sProperty] = sValue; } } diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 69d580bd5966..0006d0febe53 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1974,6 +1974,53 @@ namespace } } +bool Window::set_font_attribute(const OString &rKey, const OString &rValue) +{ + if (rKey == "weight") + { + Font aFont(GetControlFont()); + if (rValue == "thin") + aFont.SetWeight(WEIGHT_THIN); + else if (rValue == "ultralight") + aFont.SetWeight(WEIGHT_ULTRALIGHT); + else if (rValue == "light") + aFont.SetWeight(WEIGHT_LIGHT); + else if (rValue == "book") + aFont.SetWeight(WEIGHT_SEMILIGHT); + else if (rValue == "normal") + aFont.SetWeight(WEIGHT_NORMAL); + else if (rValue == "medium") + aFont.SetWeight(WEIGHT_MEDIUM); + else if (rValue == "semibold") + aFont.SetWeight(WEIGHT_SEMIBOLD); + else if (rValue == "bold") + aFont.SetWeight(WEIGHT_BOLD); + else if (rValue == "ultrabold") + aFont.SetWeight(WEIGHT_ULTRABOLD); + else + aFont.SetWeight(WEIGHT_BLACK); + SetControlFont(aFont); + } + else if (rKey == "style") + { + Font aFont(GetControlFont()); + if (rValue == "normal") + aFont.SetItalic(ITALIC_NONE); + else if (rValue == "oblique") + aFont.SetItalic(ITALIC_OBLIQUE); + else if (rValue == "italic") + aFont.SetItalic(ITALIC_NORMAL); + SetControlFont(aFont); + } + else + { + SAL_INFO("vcl.layout", "unhandled font attribute: " << rKey.getStr()); + return false; + } + return true; +} + + bool Window::set_property(const OString &rKey, const OString &rValue) { if ( diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui index 507742ec4db2..b806228adf09 100644 --- a/vcl/uiconfig/ui/printdialog.ui +++ b/vcl/uiconfig/ui/printdialog.ui @@ -372,8 +372,10 @@ True False - <b>Printer</b> - True + Printer + + + @@ -712,8 +714,10 @@ True False - <b>Range and copies</b> - True + Range and copies + + + @@ -769,8 +773,10 @@ True False - <b>Print</b> - True + Print + + + @@ -897,8 +903,10 @@ True False - <b>Print</b> - True + Print + + + @@ -1292,8 +1300,10 @@ True False - <b>Layout</b> - True + Layout + + + @@ -1350,8 +1360,10 @@ True False - <b>Page sides</b> - True + Page sides + + + @@ -1453,8 +1465,10 @@ True False - <b>Options</b> - True + Options + + +