Kaydet (Commit) 46ccafec authored tarafından Armin Le Grand's avatar Armin Le Grand

#118828# New ColorPicker, thanks go to Christian Lippka for offering it under Apache License.

üst c36a2bef
cu cui : svx NULL
cu cui : svx sax sot NULL
cu cui usr1 - all cui_mkout NULL
cu cui\inc nmake - all cui_inc NULL
cu cui\source\options nmake - all cui_options cui_inc NULL
......@@ -6,4 +6,5 @@ cu cui\source\customize nmake - all cui_customize cui_inc NULL
cu cui\source\dialogs nmake - all cui_dialogs cui_inc NULL
cu cui\source\tabpages nmake - all cui_tabpages cui_inc NULL
cu cui\source\factory nmake - all cui_factory cui_inc NULL
cu cui\util nmake - all cui_util cui_factory cui_tabpages cui_dialogs cui_customize cui_options NULL
cu cui\source\uno\services nmake - all cui_uno_services cui_inc NULL
cu cui\util nmake - all cui_util cui_factory cui_tabpages cui_dialogs cui_customize cui_options cui_uno_services NULL
......@@ -6,3 +6,5 @@ mkdir: %COMMON_DEST%\res%_EXT%
..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.*
mkdir: %COMMON_DEST%\xml%_EXT%\component\cui\util
..\%__SRC%\misc\cui.component %_DEST%\xml%_EXT%\component\cui\util\cui.component
This diff is collapsed.
......@@ -19,47 +19,45 @@
*
*************************************************************/
#ifndef _CUI_COLORPICKER_HRC_
#define _CUI_COLORPICKER_HRC_
#define DLG_COLOR 996
#include <cuires.hrc>
#define VAL_SET_COLOR 2
#define BTN_1 1
#define BTN_2 2
#define BTN_3 3
#define BTN_4 4
#define FT_RGB 12
#define FT_BOTTOMLINE 1
#define BTN_OK 2
#define BTN_CANCEL 3
#define BTN_HELP 4
#define CTL_COLOR 1
#define CT_COLORFIELD 5
#define CT_COLORSLIDER 6
#define CT_PREVIEW 7
#define CT_PREVIOUS 8
#define FT_RED 1
#define NUM_RED 1
#define FT_GREEN 2
#define NUM_GREEN 2
#define FT_BLUE 3
#define NUM_BLUE 3
#define FL_RGB 9
#define CT_RED 10
#define CT_GREEN 11
#define CT_BLUE 12
#define CT_HEX 13
#define FT_CYAN 7
#define NUM_CYAN 7
#define FT_MAGENTA 8
#define NUM_MAGENTA 8
#define FT_YELLOW 9
#define NUM_YELLOW 9
#define FT_KEY 10
#define NUM_KEY 10
#define FL_HSB 14
#define CT_HUE 15
#define CT_SATURATION 16
#define CT_BRIGHTNESS 17
#define FT_HUE 4
#define NUM_HUE 4
#define FT_SATURATION 5
#define NUM_SATURATION 5
#define FT_LUMINANCE 6
#define NUM_LUMINANCE 6
#define FL_CMYK 18
#define CT_CYAN 19
#define CT_MAGENTA 20
#define CT_YELLOW 21
#define CT_KEY 22
#define CTL_PREVIEW 3
#define CTL_PREVIEW_OLD 4
#define PB_PICKER 23
#define BTN_OK 1
#define BTN_CANCEL 1
#define BTN_HELP 1
#define CT_LEFT_SLIDER 24
#define CT_RIGHT_SLIDER 25
//IAccessibility2 Implementation 2009-----
#define STR_COLORDES 3001
#define CT_SLIDERIMG 26
#endif
// eof
This diff is collapsed.
......@@ -43,6 +43,7 @@ CFLAGS+= -DBUILD_VER_STRING="$(BUILD_VER_STRING)"
SRS1NAME=dialogs
SRC1FILES = \
about.src \
colorpicker.src \
charmap.src \
commonlingui.src \
cuiimapdlg.src \
......@@ -74,6 +75,7 @@ SRC1FILES = \
SLOFILES+=\
$(SLO)$/about.obj \
$(SLO)$/colorpicker.obj \
$(SLO)$/commonlingui.obj \
$(SLO)$/cuicharmap.obj \
$(SLO)$/cuifmsearch.obj \
......
......@@ -434,5 +434,7 @@
#define RID_SVXSTR_EVENT_RIGHTCLICK (RID_SVX_START + 1192)
#define RID_SVXSTR_EVENT_CALCULATE (RID_SVX_START + 1193)
#define RID_SVXSTR_EVENT_CONTENTCHANGED (RID_SVX_START + 1194)
#define RID_CUI_DIALOG_COLORPICKER (RID_SVX_START + 3)
#endif
......@@ -643,6 +643,7 @@ IMPL_LINK( SvxColorTabPage, ClickWorkOnHdl_Impl, void *, EMPTYARG )
ConvertColorValues (aTmpColor, CM_RGB);
pColorDlg->SetColor (aTmpColor);
pColorDlg->SetMode( svtools::ColorPickerMode_MODIFY );
if( pColorDlg->Execute() == RET_OK )
{
......
#**************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#**************************************************************
PRJ=..$/..$/..
PRJNAME=cui
TARGET=services
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/makefile.pmk
# --- Files --------------------------------------------------------
SLOFILES+=\
$(SLO)$/services.obj
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cui.hxx"
#include <com/sun/star/registry/XRegistryKey.hpp>
#include "sal/types.h"
#include "cppuhelper/factory.hxx"
#include <cppuhelper/implementationentry.hxx>
using rtl::OUString;
using namespace com::sun::star;
namespace cui {
extern rtl::OUString SAL_CALL ColorPicker_getImplementationName();
extern uno::Reference< uno::XInterface > SAL_CALL ColorPicker_createInstance( uno::Reference< uno::XComponentContext > const & ) SAL_THROW( (uno::Exception) );
extern uno::Sequence< rtl::OUString > SAL_CALL ColorPicker_getSupportedServiceNames() throw( uno::RuntimeException );
}
namespace
{
cppu::ImplementationEntry entries[] = {
{ &::cui::ColorPicker_createInstance, &::cui::ColorPicker_getImplementationName, &::cui::ColorPicker_getSupportedServiceNames, &cppu::createSingleComponentFactory, 0, 0 },
{ 0, 0, 0, 0, 0, 0 }
};
}
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( char const * implName, void * serviceManager, void * registryKey)
{
return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries);
}
extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( const sal_Char ** ppEnvTypeName, uno_Environment ** )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
// eof
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<component loader="com.sun.star.loader.SharedLibrary"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.cui.ColorPicker">
<service name="com.sun.star.ui.dialogs.ColorPicker"/>
</implementation>
</component>
UDK_3_0_0 {
global:
CreateDialogFactory;
GetSpecialCharsForEdit;
GetSpecialCharsForEdit;
component_getImplementationEnvironment;
component_getFactory;
local:
*;
};
......@@ -48,10 +48,13 @@ SHL1LIBS= \
$(SLB)$/customize.lib \
$(SLB)$/dialogs.lib \
$(SLB)$/tabpages.lib \
$(SLB)$/factory.lib
$(SLB)$/factory.lib \
$(SLB)$/services.lib
SHL1STDLIBS= \
$(SAXLIB) \
$(SOTLIB) \
$(EDITENGLIB) \
$(SVXCORELIB) \
$(SVXLIB) \
......@@ -98,5 +101,13 @@ RESLIB1SRSFILES= $(SRSFILELIST)
# --- Targets -------------------------------------------------------
ALLTAR : $(MISC)/cui.component
$(MISC)/cui.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
cui.component
$(XSLTPROC) --nonet --stringparam uri \
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
$(SOLARENV)/bin/createcomponent.xslt cui.component
.INCLUDE : target.mk
......@@ -51,6 +51,7 @@ my_components = \
charttools \
chartview \
component/comphelper/util/comphelp \
component/cui/util/cui \
component/drawinglayer/drawinglayer \
component/framework/util/fwk \
component/framework/util/fwl \
......
......@@ -50,7 +50,6 @@ $(eval $(call gb_SrsTarget_add_files,svt/res,\
svtools/source/control/ctrltool.src \
svtools/source/control/filectrl.src \
svtools/source/dialogs/addresstemplate.src \
svtools/source/dialogs/colrdlg.src \
svtools/source/dialogs/filedlg2.src \
svtools/source/dialogs/formats.src \
svtools/source/dialogs/prnsetup.src \
......
......@@ -150,7 +150,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/control/valueacc \
svtools/source/control/valueset \
svtools/source/dialogs/addresstemplate \
svtools/source/dialogs/colctrl \
svtools/source/dialogs/colrdlg \
svtools/source/dialogs/filedlg \
svtools/source/dialogs/filedlg2 \
......
......@@ -38,7 +38,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/brwbox.hxx,svtools/brw
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/brwhead.hxx,svtools/brwhead.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/calendar.hxx,svtools/calendar.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/cliplistener.hxx,svtools/cliplistener.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/colctrl.hxx,svtools/colctrl.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/collatorres.hxx,svtools/collatorres.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/colorcfg.hxx,svtools/colorcfg.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/colrdlg.hxx,svtools/colrdlg.hxx))
......
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _SV_COLCTRL_HXX
#define _SV_COLCTRL_HXX
#include <tools/color.hxx>
#include <vcl/ctrl.hxx>
#include <svtools/valueset.hxx>
// ----------------
// - ColorControl -
// ----------------
class Bitmap;
class BitmapReadAccess;
class ColorHSB;
class SvColorControl : public Control
{
private:
Bitmap* mpBitmap;
BitmapReadAccess* mpReadAccess;
Color maColor;
short mnLuminance;
Point maPosition;
Link maModifyHdl;
void Initialize();
void CreateBitmap();
void ShowPosition( const Point& aPos );
public:
SvColorControl( Window* pParent, WinBits nStyle = 0 );
SvColorControl( Window* pParent, const ResId& rResId );
~SvColorControl();
virtual void MouseMove( const MouseEvent& rMEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
// virtual void KeyInput( const KeyEvent& rKEvent );
virtual void Paint( const Rectangle& rRect );
virtual void Resize();
// virtual void GetFocus();
// virtual void LoseFocus();
virtual void Modify();
Color GetColor() const { return maColor; };
void SetColor( const Color& rCol );
void SetColor( const ColorHSB& rCol, sal_Bool bSetColor = sal_True );
short GetLuminance() const { return mnLuminance; };
void SetLuminance( short nLum );
void SetModifyHdl( const Link& rLink ) { maModifyHdl = rLink; }
const Link& GetModifyHdl() const { return maModifyHdl; }
};
// -----------------------
// - ColorPreviewControl -
// -----------------------
class ColorPreviewControl : public Control
{
private:
Color maColor;
public:
ColorPreviewControl( Window* pParent, WinBits nStyle = 0 );
ColorPreviewControl( Window* pParent, const ResId& rResId );
~ColorPreviewControl();
virtual void Paint( const Rectangle& rRect );
Color GetColor() const { return maColor; };
void SetColor( const Color& rCol );
};
// -----------------------
// - ColorMixingControl -
// -----------------------
enum CMCPosition { CMC_TOPLEFT, CMC_TOPRIGHT, CMC_BOTTOMLEFT, CMC_BOTTOMRIGHT, CMC_OTHER };
class ColorMixingControl : public ValueSet
{
private:
sal_uInt16 mnRows;
sal_uInt16 mnColumns;
Color maColor[4];
void Initialize();
Color CalcDifferenceColor( sal_uInt16 nCol1, sal_uInt16 nCol2, sal_uInt16 nSteps );
void FillRow( sal_uInt16 nRow );
void FillColumn( sal_uInt16 nColumn );
public:
ColorMixingControl( Window* pParent, WinBits nStyle = 0,
sal_uInt16 nRows = 4, sal_uInt16 nColumns = 4 );
ColorMixingControl( Window* pParent, const ResId& rResId,
sal_uInt16 nRows = 4, sal_uInt16 nColumns = 4 );
~ColorMixingControl();
sal_uInt16 GetRows() const { return mnRows; };
void SetRows( sal_uInt16 nRows );
sal_uInt16 GetColumns() const { return mnColumns; };
void SetColumns( sal_uInt16 nColumns );
using ValueSet::GetColor;
Color GetColor( CMCPosition ePos ) const { return maColor[ ePos ]; };
using ValueSet::SetColor;
void SetColor( CMCPosition ePos, const Color& rCol );
String GetRGBString( const Color& rColor );
CMCPosition GetCMCPosition() const;
};
// ------------
// - ColorHSB -
// ------------
class ColorHSB
{
private:
sal_uInt16 mnHue; // Farbwinkel, 360 Grad
sal_uInt16 mnSat; // Saturation, 100 %
sal_uInt16 mnBri; // Brightness, 100 %
public:
ColorHSB()
{ mnHue=0; mnSat=0; mnBri=0; }
ColorHSB( sal_uInt16 nH, sal_uInt16 nS, sal_uInt16 nB )
{ mnHue=nH; mnSat=nS; mnBri=nB; }
ColorHSB( const Color& rColor );
void SetHue( sal_uInt16 nH ) { mnHue=nH; }
void SetSat( sal_uInt16 nS ) { mnSat=nS; }
void SetBri( sal_uInt16 nB ) { mnBri=nB; }
sal_uInt16 GetHue() const { return mnHue; }
sal_uInt16 GetSat() const { return mnSat; }
sal_uInt16 GetBri() const { return mnBri; }
Color GetRGB() const;
};
// -------------
// - ColorCMYK -
// -------------
class ColorCMYK
{
private:
sal_uInt16 mnCyan;
sal_uInt16 mnMagenta;
sal_uInt16 mnYellow;
sal_uInt16 mnKey;
public:
ColorCMYK()
{ mnCyan=0; mnMagenta=0; mnYellow=0; mnKey=100; }
ColorCMYK( sal_uInt16 nC, sal_uInt16 nM, sal_uInt16 nY, sal_uInt16 nK )
{ mnCyan=nC; mnMagenta=nM; mnYellow=nY; mnKey=nK; }
ColorCMYK( const Color& rColor );
void SetCyan( sal_uInt16 nC ) { mnCyan=nC; }
void SetMagenta( sal_uInt16 nM ) { mnMagenta=nM; }
void SetYellow( sal_uInt16 nY ) { mnYellow=nY; }
void SetKey( sal_uInt16 nK ) { mnKey=nK; }
sal_uInt16 GetCyan() const { return mnCyan; }
sal_uInt16 GetMagenta() const { return mnMagenta; }
sal_uInt16 GetYellow() const { return mnYellow; }
sal_uInt16 GetKey() const { return mnKey; }
Color GetRGB() const;
};
#endif // _SV_COLCTRL_HXX
......@@ -19,85 +19,39 @@
*
*************************************************************/
#ifndef _SV_COLRDLG_HXX
#define _SV_COLRDLG_HXX
#include "svtools/svtdllapi.h"
#include <vcl/dialog.hxx>
#ifndef _SV_BUTTON_HXX //autogen
#include <vcl/button.hxx>
#endif
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <svtools/colctrl.hxx>
#include <tools/color.hxx>
class Window;
// ---------------
// - ColorDialog -
// ---------------
class SVT_DLLPUBLIC SvColorDialog : public ModalDialog
namespace svtools
{
private:
ColorMixingControl maColMixCtrl;
PushButton maBtn1;
PushButton maBtn2;
//PushButton maBtn3;
//PushButton maBtn4;
//FixedText maFtRGB;
SvColorControl maCtlColor;
// CMYK controls.
FixedText maFtCyan;
MetricField maNumCyan;
FixedText maFtMagenta;
MetricField maNumMagenta;
FixedText maFtYellow;
MetricField maNumYellow;
FixedText maFtKey;
MetricField maNumKey;
// RGB controls.
FixedText maFtRed;
NumericField maNumRed;
FixedText maFtGreen;
NumericField maNumGreen;
FixedText maFtBlue;
NumericField maNumBlue;
// HSL controls.
FixedText maFtHue;
NumericField maNumHue;
FixedText maFtSaturation;
NumericField maNumSaturation;
FixedText maFtLuminance;
NumericField maNumLuminance;
ColorPreviewControl maCtlPreview;
ColorPreviewControl maCtlPreviewOld;
OKButton maBtnOK;
CancelButton maBtnCancel;
HelpButton maBtnHelp;
Color maColor;
SVT_DLLPRIVATE void Initialize();
DECL_DLLPRIVATE_LINK( ColorModifyHdl, void * );
DECL_DLLPRIVATE_LINK( ClickBtnHdl, void * );
DECL_DLLPRIVATE_LINK( ClickMixCtrlHdl, void * );
DECL_DLLPRIVATE_LINK( SelectMixCtrlHdl, void * );
// SELECT is the default
enum ColorPickerMode { ColorPickerMode_SELECT = 0, ColorPickerMode_ADD = 1, ColorPickerMode_MODIFY = 2 };
}
class SVT_DLLPUBLIC SvColorDialog
{
public:
SvColorDialog( Window* pParent );
~SvColorDialog();
SvColorDialog( ::Window* pParent );
void SetColor( const Color& rColor );
const Color& GetColor() const;
void SetMode( sal_Int16 eMode );
virtual short Execute();
private:
Window* mpParent;
Color maColor;
sal_Int16 meMode;
};
#endif // _SV_COLRDLG_HXX
This diff is collapsed.
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#include "colrdlg.hrc"
#define DIFF 3
ModalDialog DLG_COLOR
{
HelpID = "svtools:ModalDialog:DLG_COLOR";
OutputSize = TRUE ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 260 , 165 + DIFF ) ;
Moveable = TRUE ;
Text [ en-US ] = "Color" ;
OKButton BTN_OK
{
Pos = MAP_APPFONT ( 205 , 6 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton BTN_CANCEL
{
Pos = MAP_APPFONT ( 205 , 23 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
HelpButton BTN_HELP
{
Pos = MAP_APPFONT ( 205 , 43 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
Control VAL_SET_COLOR
{
Border = TRUE ;
Pos = MAP_APPFONT ( 6 , 6 ) ;
Size = MAP_APPFONT ( 91 , 100 ) ;
TabStop = TRUE ;
};
Control CTL_COLOR
{
Border = TRUE ;
Pos = MAP_APPFONT ( 100 , 6 ) ;
Size = MAP_APPFONT ( 100 , 100 ) ;
TabStop = TRUE ;
};
FixedText FT_CYAN
{
Pos = MAP_APPFONT ( 6 , 110 + DIFF ) ;
Size = MAP_APPFONT ( 34 , 10 ) ;
Text [ en-US ] = "~Cyan" ;
};
FixedText FT_MAGENTA
{
Pos = MAP_APPFONT ( 6 , 123 + DIFF ) ;
Size = MAP_APPFONT ( 34 , 10 ) ;
Text [ en-US ] = "~Magenta" ;
};
FixedText FT_YELLOW
{
Pos = MAP_APPFONT ( 6 , 136 + DIFF ) ;
Size = MAP_APPFONT ( 34 , 10 ) ;
Text [ en-US ] = "~Yellow" ;
};
FixedText FT_KEY
{
Pos = MAP_APPFONT ( 6 , 149 + DIFF ) ;
Size = MAP_APPFONT ( 34 , 10 ) ;
Text [ en-US ] = "~Key" ;
};
MetricField NUM_CYAN
{
HelpID = "svtools:MetricField:DLG_COLOR:NUM_CYAN";
Border = TRUE ;
Pos = MAP_APPFONT ( 42 , 109 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
Last = 100 ;
Unit = FUNIT_CUSTOM ;
CustomUnitText = " %" ;
};
MetricField NUM_MAGENTA
{
HelpID = "svtools:MetricField:DLG_COLOR:NUM_MAGENTA";
Border = TRUE ;
Pos = MAP_APPFONT ( 42 , 122 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
Last = 100 ;
Unit = FUNIT_CUSTOM ;
CustomUnitText = " %" ;
};
MetricField NUM_YELLOW
{
HelpID = "svtools:MetricField:DLG_COLOR:NUM_YELLOW";
Border = TRUE ;
Pos = MAP_APPFONT ( 42 , 135 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
Last = 100 ;
Unit = FUNIT_CUSTOM ;
CustomUnitText = " %" ;
};
MetricField NUM_KEY
{
HelpID = "svtools:MetricField:DLG_COLOR:NUM_KEY";
Border = TRUE ;
Pos = MAP_APPFONT ( 42 , 148 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
Last = 100 ;
Unit = FUNIT_CUSTOM ;
CustomUnitText = " %" ;
};
FixedText FT_RED
{
Pos = MAP_APPFONT ( 72 , 123 + DIFF ) ;
Size = MAP_APPFONT ( 33 , 10 ) ;
Text [ en-US ] = "~Red" ;
};
FixedText FT_GREEN
{
Pos = MAP_APPFONT ( 72 , 136 + DIFF ) ;
Size = MAP_APPFONT ( 33 , 10 ) ;
Text [ en-US ] = "~Green" ;
};
FixedText FT_BLUE
{
Pos = MAP_APPFONT ( 72 , 149 + DIFF ) ;
Size = MAP_APPFONT ( 33 , 10 ) ;
Text [ en-US ] = "~Blue" ;
};
NumericField NUM_RED
{
HelpID = "svtools:NumericField:DLG_COLOR:NUM_RED";
Border = TRUE ;
Pos = MAP_APPFONT ( 106 , 122 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 255 ;
Last = 255 ;
};
NumericField NUM_GREEN
{
HelpID = "svtools:NumericField:DLG_COLOR:NUM_GREEN";
Border = TRUE ;
Pos = MAP_APPFONT ( 106 , 135 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 255 ;
Last = 255 ;
};
NumericField NUM_BLUE
{
HelpID = "svtools:NumericField:DLG_COLOR:NUM_BLUE";
Border = TRUE ;
Pos = MAP_APPFONT ( 106 , 148 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 255 ;
Last = 255 ;
};
FixedText FT_HUE
{
Pos = MAP_APPFONT ( 135 , 123 + DIFF ) ;
Size = MAP_APPFONT ( 34 , 10 ) ;
Text [ en-US ] = "H~ue" ;
};
NumericField NUM_HUE
{
HelpID = "svtools:NumericField:DLG_COLOR:NUM_HUE";
Border = TRUE ;
Pos = MAP_APPFONT ( 171 , 122 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 359 ;
Last = 359 ;
};
FixedText FT_SATURATION
{
Pos = MAP_APPFONT ( 135 , 136 + DIFF ) ;
Size = MAP_APPFONT ( 34 , 10 ) ;
Text [ en-US ] = "~Saturation" ;
};
NumericField NUM_SATURATION
{
HelpID = "svtools:NumericField:DLG_COLOR:NUM_SATURATION";
Border = TRUE ;
Pos = MAP_APPFONT ( 171 , 135 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
Last = 100 ;
};
FixedText FT_LUMINANCE
{
Pos = MAP_APPFONT ( 135 , 149 + DIFF ) ;
Size = MAP_APPFONT ( 34 , 10 ) ;
Text [ en-US ] = "Bright~ness" ;
};
NumericField NUM_LUMINANCE
{
HelpID = "svtools:NumericField:DLG_COLOR:NUM_LUMINANCE";
Border = TRUE ;
Pos = MAP_APPFONT ( 171 , 148 + DIFF ) ;
Size = MAP_APPFONT ( 26 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
Last = 100 ;
};
PushButton BTN_1
{
HelpID = "svtools:PushButton:DLG_COLOR:BTN_1";
Pos = MAP_APPFONT ( 80 , 109 ) ;
Size = MAP_APPFONT ( 17 , 12 ) ;
Text = "~<--" ;
TabStop = TRUE ;
};
PushButton BTN_2
{
HelpID = "svtools:PushButton:DLG_COLOR:BTN_2";
Pos = MAP_APPFONT ( 100 , 109 ) ;
Size = MAP_APPFONT ( 17 , 12 ) ;
Text = "--~>" ;
TabStop = TRUE ;
};
Control CTL_PREVIEW_OLD
{
Border = TRUE ;
Pos = MAP_APPFONT ( 200 , 109 ) ;
Size = MAP_APPFONT ( 26 , 51 + DIFF ) ;
TabStop = FALSE ;
};
Control CTL_PREVIEW
{
Border = TRUE ;
Pos = MAP_APPFONT ( 229 , 109 ) ;
Size = MAP_APPFONT ( 26 , 51 + DIFF ) ;
TabStop = FALSE ;
};
};
String STR_COLORDES
{
Text [ en-US ] = "RGB(%1, %2, %3) Hue:%4 Saturation:%5 Brightness:%6";
};
......@@ -174,10 +174,14 @@ public:
static ColorData HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri );
void RGBtoHSB( sal_uInt16& nHue, sal_uInt16& nSat, sal_uInt16& nBri ) const;
sal_Bool operator==( const Color& rColor ) const
{ return (mnColor == rColor.mnColor); }
sal_Bool operator!=( const Color& rColor ) const
{ return !(Color::operator==( rColor )); }
// the range for cymk is 0 to 1.0
static ColorData CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey );
void RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey );
sal_Bool operator==( const Color& rColor ) const
{ return (mnColor == rColor.mnColor); }
sal_Bool operator!=( const Color& rColor ) const
{ return !(Color::operator==( rColor )); }
SvStream& Read( SvStream& rIStm, sal_Bool bNewFormat = sal_True );
SvStream& Write( SvStream& rOStm, sal_Bool bNewFormat = sal_True );
......
......@@ -259,6 +259,53 @@ ColorData Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri )
// -----------------------------------------------------------------------
// CMYK values from 0 to 1
ColorData Color::CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey )
{
fCyan = (fCyan * ( 1.0 - fKey )) + fKey;
fMagenta = (fMagenta * ( 1.0 - fKey )) + fKey;
fYellow = (fYellow * ( 1.0 - fKey )) + fKey;
sal_uInt8 nRed = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fCyan ) * 255.0, 255.0), 0.0 ) );
sal_uInt8 nGreen = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fMagenta ) * 255.0, 255.0), 0.0 ) );
sal_uInt8 nBlue = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fYellow ) * 255.0, 255.0), 0.0 ) );
return RGB_COLORDATA( nRed, nGreen, nBlue );
}
// -----------------------------------------------------------------------
// RGB values from 0 to 255
// CMY results from 0 to 1
void Color::RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey )
{
fCyan = 1 - ( GetRed() / 255.0 );
fMagenta = 1 - ( GetGreen() / 255.0 );
fYellow = 1 - ( GetBlue() / 255.0 );
//CMYK and CMY values from 0 to 1
fKey = 1.0;
if( fCyan < fKey ) fKey = fCyan;
if( fMagenta < fKey ) fKey = fMagenta;
if( fYellow < fKey ) fKey = fYellow;
if ( fKey == 1.0 )
{
//Black
fCyan = 0.0;
fMagenta = 0.0;
fYellow = 0.0;
}
else
{
fCyan = ( fCyan - fKey ) / ( 1.0 - fKey );
fMagenta = ( fMagenta - fKey ) / ( 1.0 - fKey );
fYellow = ( fYellow - fKey ) / ( 1.0 - fKey );
}
}
// -----------------------------------------------------------------------
SvStream& Color::Read( SvStream& rIStm, sal_Bool bNewFormat )
{
if ( bNewFormat )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment